<?php
	#**************************************#
	#	Class for Track Server 
	#	Date   : Monday, May 26, 2008 1:54 PM
	#	Author : Mamat 
	#	Email  : abuma@amikom.ac.id
	#*************************************#

	class Track {
		
		function addTrack($trackData){
			$mysql = new Mysql();
			$mysql->connect();				
			$query = "insert into track (trackdata) values ('$trackData')";
			$mysql->execute($query);				
			$mysql->closeConnection();
			
		}
		
		function getTrack(){
			$mysql = new Mysql();
			$mysql->connect();
			
			$query = "select * from track order by trackid desc";
			if($mysql->execute($query)) {
				return $mysql->getDataSet();
			} else {
				return false;
			}				
			$mysql->closeConnection();
		}
		
		function getPageTrack($row,$jpage){
			$mysql = new Mysql();
			$mysql->connect();
			
			$query = "select * from track order by trackid desc limit $row,$jpage";
			if($mysql->execute($query)) {
				return $mysql->getDataSet();
			} else {
				return false;
			}				
			$mysql->closeConnection();
		}
		
		function getNumsRowPage(){
			$mysql = new Mysql();
			$mysql->connect();
			
			$query = "select count(trackid) from track ";
			if($mysql->execute($query)) {
				$data = $mysql->getDataSet();
				return $data[0][0];
			} else {
				return 0;
			}				
			$mysql->closeConnection();
			
		}
	}
?>